window.phoenix&&(window.phoenix.buildInfo||(window.phoenix.buildInfo=[]),-1===window.phoenix.buildInfo.findIndex((e=>"Phoenix-platform"===e.MFE))&&window.phoenix.buildInfo.push({MFE:"Phoenix-platform",VERSION:"4f801c6",LASTCOMMITDATETIME:"2024-07-08T07:55:19+00:00"})) /*! * * ============= BUILD INFO ============= * MFE: Phoenix-platform * chunkName: clientlib-platform-main/index * VERSION: 4f801c6 * BRANCH: HEAD * COMMITHASH: 4f801c6a05dec11337fda6d090793eee14303a13 * LASTCOMMITDATETIME: 2024-07-08T07:55:19+00:00 * ============= If you're reading this, why not come work with us? https://www.t-mobile.com/careers ============= */,function(){var e={483:function(e,t,n){ /*! localForage -- Offline Storage, Improved Version 1.10.0 https://localforage.github.io/localForage (c) 2013-2017 Mozilla, Apache License 2.0 */ e.exports=function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){var n=t[a][1][e];return o(n||e)}),u,u.exports,e,t,n,r)}return n[a].exports}for(var i=void 0,a=0;a=43)}})).catch((function(){return!1}))}function S(e){return"boolean"==typeof v?u.resolve(v):E(e).then((function(e){return v=e}))}function _(e){var t=b[e.name],n={};n.promise=new u((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function I(e){var t=b[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function R(e,t){var n=b[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function x(e,t){return new u((function(n,r){if(b[e.name]=b[e.name]||F(),e.db){if(!t)return n(e.db);_(e),e.db.close()}var o=[e.name];t&&o.push(e.version);var i=a.open.apply(a,o);t&&(i.onupgradeneeded=function(t){var n=i.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(p)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),i.onerror=function(e){e.preventDefault(),r(i.error)},i.onsuccess=function(){var t=i.result;t.onversionchange=function(e){e.target.close()},n(t),I(e)}}))}function N(e){return x(e,!1)}function T(e){return x(e,!0)}function A(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.versione.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function C(e){return new u((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(n){var r=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:r,type:e.type})},r.readAsBinaryString(e)}))}function O(e){return c([y(atob(e.data))],{type:e.type})}function D(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,n=t._initReady().then((function(){var e=b[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return l(n,e,e),n}function j(e){_(e);for(var t=b[e.name],n=t.forages,r=0;r0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return u.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),T(e)})).then((function(){return j(e).then((function(){P(e,t,n,r-1)}))})).catch(n);n(o)}}function F(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function M(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=b[n.name];o||(o=F(),b[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=k);var i=[];function a(){return u.resolve()}for(var s=0;s>4,f[c++]=(15&r)<<4|o>>2,f[c++]=(3&o)<<6|63&i;return u}function pe(e){var t,n=new Uint8Array(e),r="";for(t=0;t>2],r+=V[(3&n[t])<<4|n[t+1]>>4],r+=V[(15&n[t+1])<<2|n[t+2]>>6],r+=V[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function ve(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var r,o=K;e instanceof ArrayBuffer?(r=e,o+=ee):(r=e.buffer,"[object Int8Array]"===n?o+=ne:"[object Uint8Array]"===n?o+=re:"[object Uint8ClampedArray]"===n?o+=oe:"[object Int16Array]"===n?o+=ie:"[object Uint16Array]"===n?o+=se:"[object Int32Array]"===n?o+=ae:"[object Uint32Array]"===n?o+=ce:"[object Float32Array]"===n?o+=ue:"[object Float64Array]"===n?o+=fe:t(new Error("Failed to get type for BinaryArray"))),t(o+pe(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n=X+e.type+"~"+pe(this.result);t(K+te+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function be(e){if(e.substring(0,Z)!==K)return JSON.parse(e);var t,n=e.substring(le),r=e.substring(Z,le);if(r===te&&Y.test(n)){var o=n.match(Y);t=o[1],n=n.substring(o[0].length)}var i=he(n);switch(r){case ee:return i;case te:return c([i],{type:t});case ne:return new Int8Array(i);case re:return new Uint8Array(i);case oe:return new Uint8ClampedArray(i);case ie:return new Int16Array(i);case se:return new Uint16Array(i);case ae:return new Int32Array(i);case ce:return new Uint32Array(i);case ue:return new Float32Array(i);case fe:return new Float64Array(i);default:throw new Error("Unkown type: "+r)}}var we={serialize:ve,deserialize:be,stringToBuffer:he,bufferToString:pe};function ge(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function me(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new u((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(o){ge(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=we,o}function ye(e,t,n,r,o,i){e.executeSql(n,r,o,(function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?i(e,a):ge(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function Ee(e,t){var n=this;e=d(e);var r=new u((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){ye(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return f(r,t),r}function Se(e,t){var n=this,r=new u((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){ye(n,o,"SELECT * FROM "+o.storeName,[],(function(n,r){for(var i=r.rows,a=i.length,s=0;s0)return void i(_e.apply(o,[e,s,n,r-1]));a(t)}}))}))})).catch(a)}));return f(i,n),i}function Ie(e,t,n){return _e.apply(this,[e,t,n,1])}function Re(e,t){var n=this;e=d(e);var r=new u((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){ye(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return f(r,t),r}function xe(e){var t=this,n=new u((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){ye(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return f(n,e),n}function Ne(e){var t=this,n=new u((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){ye(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return f(n,e),n}function Te(e,t){var n=this,r=new u((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){ye(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return f(r,t),r}function Ae(e){var t=this,n=new u((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){ye(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],o=0;o '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var o=[],i=0;i0}function Me(e){var t=this,n={};if(e)for(var r in e)n[r]=e[r];return n.keyPrefix=je(e,t._defaultConfig),Fe()?(t._dbInfo=n,n.serializer=we,u.resolve()):u.reject()}function Le(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return f(n,e),n}function $e(e,t){var n=this;e=d(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return f(r,t),r}function Be(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,s=0;s=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):u.reject("Invalid arguments"),f(r,t),r}var Qe={_driver:"localStorageWrapper",_initStorage:Me,_support:ke(),iterate:Be,getItem:$e,setItem:ze,removeItem:Ge,clear:Le,length:He,key:Ue,keys:qe,dropInstance:We},Je=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ve=function(e,t){for(var n=e.length,r=0;r]+)>)/gi,""),content:t?.bodyCopy,ctas:t?.ctas}})}doRedirect(e){if(this.isAuthorMode)return void window.phoenix.log.warning("Author Mode detected, stopping redirects!",this.logDetails);if(this.reportError(e?.payload),e?.payload&&e.payload.errorPayload){const t=e?.payload?.errorPayload;window.location.assign(t?.content)}const t=document.querySelector("body")?.dataset.errorPage;t?window.location.assign(t):window.phoenix.log.warning("Unable to redirect, no error page found in data object on the body.",this.logDetails)}async fetchContentFragment(e){let t=null,n=null,o=e?.payload?.topic;const i=e?.payload?.source??"runtime";if("runtime"===i){t=window.phoenix.configs?.apiDomainsConfigs?.["servlet-runtime-notification"]?.apiPath||"/self-service-content/runtimeNotification";const n=e?.payload?.error,r=n?.content;r?.notificationCode&&(t+=`.notificationCode_${r.notificationCode}`),r?.namespace&&(t+=`.namespace_${r.namespace}`)}if("errors"===i){t=window.phoenix.configs?.apiDomainsConfigs?.["servlet-errors"]?.apiPath||"/self-service-content/errors/";const n=e?.payload?.error;n?.errorCode&&(t+=`${n?.errorCode}`)}try{const e=await fetch(`${t}.json`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}});if(!e.ok)return window.phoenix.log.error(`Could not retrieve content fragment path: ${t} with status: ${e?.status}`,this.logDetails),void window.phoenix.bus.publish("ERROR","CONTENT_FRAGMENT_FETCH_SUCCESS_WITH_ERROR");const a=await e.json();if(!("runtime"!==i||a?.message&&0!==a?.message.trim().length))return void window.phoenix.log.error("Content fragment is empty.",this.logDetails);if("runtime"===i&&(n=a),!("errors"!==i||a?.errorCode&&0!==a?.errorCode.trim().length))return void window.phoenix.log.error("Content fragment is empty.",this.logDetails);"errors"===i&&(n={errorPayload:{...a}},o||(o=a?.errorType,n={errorPayload:(0,r.n)(o,a)})),window.phoenix.bus.publish("ERROR",o,{payload:n})}catch(e){return window.phoenix.log.error(`Could not retrieve content fragment path: ${t}.`,this.logDetails,{exception:e}),void window.phoenix.bus.publish("ERROR","CONTENT_FRAGMENT_FAILURE")}}globalHandler(){window.addEventListener("error",(e=>{window.phoenix.log.error(`Unhandled exception caught: ${e?.message} file: ${e?.filename} lineno: ${e?.lineno} colno: ${e?.colno}`,this.logDetails,e.error)})),window.addEventListener("unhandledrejection",(e=>{window.phoenix.log.error(`unhandled promise rejection caught: ${e?.reason}`,this.logDetails)}))}}},244:function(e,t,n){"use strict";n.d(t,{n:function(){return r}});const r=(e,t)=>{let n={};switch(e){case"RUNTIME_NOTIFICATION":n=o(t);break;case"MODAL":default:n={...t};break;case"FULL_PAGE":n=i(t)}return n},o=e=>({title:e?.title,content:e?.bodyCopy,type:e?.errorLevel?.toUpperCase(),disableClose:e?.disableClose,hideIcon:e?.hideIcon,autoClose:e?.autoClose}),i=e=>({title:e?.title?.replace(/(<([^>]+)>)/gi,""),content:e?.bodyCopy,ctas:e?.ctas,hideIcon:e?.hideIcon})}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=n(811);function t(e){try{if(e instanceof Element||e instanceof Document||e instanceof Window)return e;const n=Object.getOwnPropertyNames(e);for(const r of n){const n=e[r];n&&"object"==typeof n&&t(n)}return Object.freeze(e)}catch(t){return console.error(t),e}}class r{static allTopics=Symbol.for("ALL_TOPICS");replayQueue=new Map;channel;topics=new Map;constructor(e){this.channel=e,this.topics.set(r.allTopics,new Map)}publish(e,t){const n=this.getPerformanceName(e);if(this.channel!==Symbol.for("PUBSUB_DEBUGGER")){const n=performance.mark(`${this.getPerformanceName(e)}|StartPublish`);window.phoenix.bus.publish("PUBSUB_DEBUGGER","PUBSUB_EVENT",{payload:{publishedMark:n,datagram:t}})}this.replayQueue.set(e,Object.assign({},t)),this.topics.has(e)&&this.topics.get(e).forEach((e=>{window.requestAnimationFrame((()=>this.measureCallback.call(this,n,e,t)))})),this.topics.get(r.allTopics).forEach((e=>{window.requestAnimationFrame((()=>this.measureCallback.call(this,n,e,t)))})),this.channel!==Symbol.for("PUBSUB_DEBUGGER")&&(performance.mark(`${n}|FinishPublish`),performance.measure(`${n}|Publish`,`${n}|StartPublish`,`${n}|FinishPublish`))}subscribe(e,t,n){this.topics.has(e)||this.topics.set(e,new Map);const r=this.topics.get(e),o=Symbol(window.uuid.v4());if(r.set(o,t),n){const n=this.replayQueue.get(e);n&&window.requestAnimationFrame((()=>this.measureCallback.call(this,this.getPerformanceName(e),t,n)))}return()=>{this.unsubscribe(e,o)}}unsubscribe(e,t){this.topics.get(e).delete(t)}async measureCallback(e,t,n){this.channel!==Symbol.for("PUBSUB_DEBUGGER")&&performance.mark(`${e}|StartPublishHandler`),await t(n),this.channel!==Symbol.for("PUBSUB_DEBUGGER")&&(performance.mark(`${e}|FinishPublishHandler`),performance.measure(`${e}|PublishHandler`,`${e}|StartPublishHandler`,`${e}|FinishPublishHandler`))}getPerformanceName(e){return`PubSub|${Symbol.keyFor(this.channel)}|${Symbol.keyFor(e)}`}}var o=r;const i={appName:"phoenix-platform",className:"ShowHideService"};var a=n(483),s=n.n(a);class c{static dbVersion=1.1;static indexdbStore;static memoryStore=new Map;currentStorage="MEMORY";constructor(e="MEMORY"){"INDEXDB"===e&&window?.localforage?.supports(s().INDEXEDDB)?(this.currentStorage=e,c.indexdbStore=window.localforage.createInstance({name:"phx-state-service",description:"T-Mobile State Service storage",storeName:"StateService",version:c.dbVersion})):this.currentStorage="MEMORY"}async get(e){return"MEMORY"===this.currentStorage?this.breakReference(c.memoryStore.get(e)):await c.indexdbStore.getItem(e)}async set(e,t){"MEMORY"===this.currentStorage?c.memoryStore.set(e,this.breakReference(t)):await c.indexdbStore.setItem(e,t)}async delete(e){"MEMORY"===this.currentStorage?c.memoryStore.delete(e):await c.indexdbStore.removeItem(e)}breakReference(e){return e&&"object"==typeof e?Object.assign({},e):e}}class u{static callbackStore=new Map;stateStore;constructor(e=new c("INDEXDB")){this.stateStore=e}async del(e){if(!e)return;if("string"!=typeof e)return;const t=u.callbackStore.get(e);if(!t)return void await this.stateStore.delete(e);const n=await this.stateStore.get(e);await this.stateStore.delete(e),this.handleCbs(t,null,n),u.callbackStore.delete(e)}async set(e,t){await this.setOpts(e,t,"AX")}async setOpts(e,t,n){if(!e)return;if("string"!=typeof e)return;const r=await this.stateStore.get(e);if("GET"===n&&r)return r;if("NX"===n&&r)return;if("XX"===n&&!r)return;const o=u.callbackStore.get(e);if(r||o||"GET"===n){if(o){const n=await this.get(e);await this.stateStore.set(e,t);const r=await this.get(e);this.handleCbs(o,r,n)}else await this.stateStore.set(e,t);return"GET"===n?null:void 0}await this.stateStore.set(e,t)}async get(e){if(!e)return null;if("string"!=typeof e)return null;const t=await this.stateStore.get(e);return t||null}async watch(e,t){if(!e)return;if("string"!=typeof e)return;if(!t)return;if("function"!=typeof t)return;const n=u.callbackStore.get(e);if(!n){const n=[];return n.push(t),void u.callbackStore.set(e,n)}n.push(t)}handleCbs(e,t,n){e&&e.forEach((e=>{window.requestAnimationFrame((()=>{e.call(this,n,t)}))}))}}window.phoenix=window.phoenix||{},window.phoenix.queue=window.phoenix.queue||[],window.phoenix.bus=window.phoenix.bus||new class{bus=new Map;logDetails={appName:"phoenix-platform",className:"PubSub"};publish(e,n,r,o){const i={id:Symbol.for(window.uuid.v4()),channel:Symbol.for(e.toUpperCase()),topic:Symbol.for(n.toUpperCase()),...r};return o&&(i.source={...o}),this.getOrCreateChannel(i.channel).publish(Symbol.for(n.toUpperCase()),t(i)),i.id}subscribe(e,t,n,r){if(e&&e.trim&&""!==e.trim()||window.phoenix.log.error("Cannot subscribe to empty channel name.",this.logDetails),Array.isArray(t)){const r=t.map((t=>this.subscribe(e,t,n)));return()=>{r.forEach((e=>e()))}}return this.getOrCreateChannel(Symbol.for(e.toUpperCase())).subscribe(Symbol.for(t.toUpperCase()),n,r)}getOrCreateChannel(e){let t;return this.bus.has(e)?t=this.bus.get(e):(t=new o(e),this.bus.set(e,t)),t}},window.phoenix.scriptInjections=window.phoenix.scriptInjections||[],window.phoenix.state=window.phoenix.state||new u(new c("MEMORY")),window.phoenix.persistedState=window.phoenix.persistedState||new u(new c("INDEXDB")),window.phoenix.analytics=window.phoenix.analytics||{},window.phoenix.configs=window.phoenix.configs||{},window.phoenix.configs&&(window.phoenix.configs.featureFlags||(window.phoenix.configs.featureFlags=[]),window.phoenix.configs.apiDomainsConfigs||(window.phoenix.configs.apiDomainsConfigs={}),window.phoenix.configs.appConfigs||(window.phoenix.configs.appConfigs=[]),window.phoenix.configs.serviceConfigs||(window.phoenix.configs.serviceConfigs=[])),window.phoenix.getAppConfig=e=>window.phoenix.configs&&Array.isArray(window.phoenix.configs.appConfigs)&&window.phoenix.configs.appConfigs.find((t=>t?.key?.toLowerCase()===e?.toLowerCase()))?.value||null,window.phoenix.checkFeatureFlag=e=>window.phoenix.configs&&Array.isArray(window.phoenix.configs.featureFlags)&&window.phoenix.configs.featureFlags.findIndex((t=>t?.key?.toLowerCase()===e?.toLowerCase()&&t.enabled))>-1||!1,window.phoenix.logEntries=[],window.phoenix.log=new class{appenders;constructor(e){this.appenders=e||[]}clearwater(e,t){if(e&&t)try{this.appenders.forEach((n=>{n?.writeClearwater&&n.writeClearwater(e,t)}))}catch(e){console.error("Error logging to clearwater",e)}}debug(e,t,n){this.writelog("debug",e,t,n)}info(e,t,n){this.writelog("info",e,t,n)}warning(e,t,n){this.writelog("warning",e,t,n)}error(e,t,n){this.writelog("error",e,t,n)}writelog(e,t,n,r){try{this.appenders.forEach((o=>{let i="";i=o?.formatter?o.formatter(e,t,n,r):this.formatMsg(e,t,n,r),o.write(e,i)}))}catch(e){console.error("Error writelog",e)}}formatMsg(e,t,n,r){let o="";n&&(o="[",Object.values(n).forEach((e=>{o=`${o} ${e.valueOf()} `})),o=`${o}]`);let i=`${t}`;r&&(i=`${t} -- ${JSON.stringify(r)}`);const a=new Date(Date.now()).toUTCString();return""!==o?`[${a}] [${e}] ${o} ${i}`:`[${a}] [${e}] ${i}`}}([new class{enabled;NPE;apiPath="/self-service-commerce/v1/logging";userToken=null;constructor(){"function"==typeof window?.phoenix?.checkFeatureFlag&&window.phoenix.checkFeatureFlag("splunkLog")?this.enabled=!0:this.enabled=!1,"function"==typeof window?.phoenix?.checkFeatureFlag&&window.phoenix.checkFeatureFlag("splunkNPE")&&this.enabled?this.NPE=!0:this.NPE=!1,this.enabled&&window.phoenix.bus.subscribe("PLATFORM_AUTHORIZATION","SET_JWT",this.setJwt.bind(this))}write(e,t){this.enabled&&"error"===e&&t&&this.sendToSplunk(t)}writeClearwater(e,t){if(!(this.enabled&&this.NPE&&e&&t))return;let n="";e.RequestHeaders&&(n=JSON.stringify(this.removeHeaders(e.RequestHeaders)));let r="";e.ResponseHeaders&&(r=JSON.stringify(this.removeHeaders(e.ResponseHeaders)));const o=this?.userToken?.ent?.acct,{ban:i,msisdn:a,atst:s}=this.getUserDetailsFromToken(o),c=`RequestId=${e?.RequestId} | RequestTime=${e?.RequestTime} | Sender=${e?.Sender} | SenderType=${e?.SenderType} | Method=${e?.Method} | Receiver=${e?.Receiver} | Duration=${e?.Duration} | ResponseStatusCode=${e?.ResponseStatusCode} | Result=${e?.Result} | RequestHeaders=${n} | RequestBody=${e?.RequestBody} | ResponseHeaders=${r} | ResponseBody=${e.ResponseBody} | TargetEndpoint=${e.TargetEndpoint} | msg=${e?.msg} | details=${this.formatDetailsObj(e?.obj)} | page=${window.location.href} | userAgent=${navigator.userAgent} | ban=${i} | msisdn=${a} | atst=${s} | app=${t?.appName} | class=${t?.className} | method=${t?.methodName}`;this.sendToSplunk(JSON.stringify({message:c,type:"clearwater"}))}formatter(e,t,n,r){if(!this.enabled)return"";if("error"!==e)return"";if("Unhandled exception caught: Script error. file: lineno: 0 colno: 0"===t)return"";const o=this?.userToken?.ent?.acct,{ban:i,msisdn:a,atst:s}=this.getUserDetailsFromToken(o),c=this.formatDetailsObj(r),u=`logType=${e} | message=${t} | app=${n?.appName} | class=${n?.className} | method=${n?.methodName} | page=${window.location.href} | userAgent=${navigator.userAgent} | ban=${i} | msisdn=${a} | atst=${s} | quantumMetricSessionId=${window?.Cookies?.get("QuantumMetricSessionID")} | details=${c}`;return JSON.stringify({message:u,type:"error"})}getUserDetailsFromToken(e){let t="",n="",r="";if(e){e[0]?.id&&(t=e[0].id),e[0]?.tst&&(n=e[0].tst);const o=e[0]?.lines?.find((e=>"PRIMARY"===e?.lineUse));o?.phnum&&(r=o.phnum)}return{ban:t,msisdn:r,atst:n}}formatDetailsObj(e){let t="";if(e instanceof Error){const n={};Object.getOwnPropertyNames(e).forEach((t=>{n[t]=e[t]})),t=JSON.stringify(n)}else t=JSON.stringify(e);return t}removeHeaders(e){if(!e)return e;const t={};for(const[n,r]of Object.entries(e))n.match(/authorization/gi)||n.match(/set-cookie/gi)||n.match(/x-auth-originator/gi)||(t[n]=r);return t}sendToSplunk(e){fetch(this.apiPath,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:e}).then((e=>{200!==e.status&&console.error(`Error posting logs to ${this.apiPath} received ${e.status} status code from logging endpoint.`)})).catch((e=>{console.error(`Error posting logs to ${this.apiPath}`,e)}))}setJwt(e){this.userToken=e?.payload?.token}},new class{write(e,t){if(t)switch(e){case"info":console.info(t);break;case"warning":console.warn(t);break;case"error":console.error(t);break;case"debug":console.debug(t)}}},new class{info=261;warning=260;error=259;enabled;constructor(){"function"==typeof window?.phoenix?.checkFeatureFlag&&window.phoenix.checkFeatureFlag("logQM")?this.enabled=!0:this.enabled=!1}write(e,t){if(!1!==this.enabled&&t&&window.QuantumMetricAPI)switch(e){case"error":window.QuantumMetricAPI.sendEvent(this.error,0,t);break;case"info":window.QuantumMetricAPI.sendEvent(this.info,0,t);break;case"warning":window.QuantumMetricAPI.sendEvent(this.warning,0,t)}}}]);(new e.Z).startApp(),document.body.dataset.alpineInit="false",window.phoenix.bus.publish("PLATFORM_ALPINE","ALPINE_INITIALIZED",{payload:{isInitialized:!1}}),document.addEventListener("alpine:initialized",(()=>{document.body.dataset.alpineInit="true",window.phoenix.bus.publish("PLATFORM_ALPINE","ALPINE_INITIALIZED",{payload:{isInitialized:!0}})})),new class{_allTopics="ALL_TOPICS";targetAttribute;activeAttribute;maskAttribute;constructor(){this.targetAttribute="data-xpr-visibility-scope",this.activeAttribute="data-xpr-visibility-active",this.maskAttribute="data-xpr-visibility-mask",this.events()}registerMap(e){e.init&&this.toggle(e.init,!0),e.mask&&e.mask.length&&e.mask.forEach((e=>{const t=document.querySelector(`[${this.targetAttribute}="${e}"]`);t&&(t.setAttribute(this.maskAttribute,"true"),this.disableInputs(t,!1))})),window.phoenix.bus.subscribe(e.channel,this._allTopics,(t=>{t?.topic?.description!==this._allTopics&&this.action(e.actions?.[t?.topic?.description],!0)}))}manageFocus(e){try{const t=e?.querySelector(":is(h1,h2,h3,h4,h5,h6):first-of-type")||e?.querySelector("p:first-of-type"),n=e.querySelector("button:first-of-type"),r=t||n;t&&t?.setAttribute("tabindex","-1"),r&&r?.focus()}catch(e){return void window.phoenix.log.error("An error ocurred while attempting to set focus on the revealed element",i,e)}}toggle(e,t,n){try{if(!e||!e.length)return void window.phoenix.log.warning("Target is not defined",i);e.forEach((e=>{const r=document.querySelector(`[${this.targetAttribute}="${e}"]`);r?(t?(r.dataset.xprVisibilityActive="",n&&this.manageFocus(r)):(delete r.dataset.xprVisibilityActive,delete r.dataset.xprVisibilityMask),r.dataset.xprVisibilityMask&&this.disableInputs(r,t)):window.phoenix.log.warning(`Target [${this.targetAttribute}="${e}"] for show hide was not found`,i,e)}))}catch(e){window.phoenix.log.error("Error attempting to show hide",i,e)}}disableInputs(e,t){if(!e)return;const n=e.querySelectorAll("button,fieldset,option,select,textarea,input");for(const e of n)t?(e.disabled=!1,e.setAttribute("aria-disabled","false")):(e.disabled=!0,e.setAttribute("aria-disabled","true"))}events(){window.phoenix.bus.subscribe("SHOW_HIDE","TOGGLE",(e=>{this.action(e?.payload)})),window.phoenix.bus.subscribe("SHOW_HIDE","REGISTER_MAP",(e=>{e?.payload&&this.registerMap(e.payload)}))}action(e,t=!1){e?.show&&this.toggle(e.show,!0,t),e?.hide&&this.toggle(e.hide,!1,t)}},window.phoenix.log.debug("Phoenix platform finished starting.",{appName:"platform",className:"startup"});[{eventReference:document,eventType:"at-body-shown"},{eventReference:document,eventType:window.adobe?.target?.event?.CONTENT_RENDERING_FAILED||"at-content-rendering-failed"},{eventReference:document,eventType:window.adobe?.target?.event?.CONTENT_RENDERING_NO_OFFERS||"at-content-rendering-no-offers"},{eventReference:document,eventType:window.adobe?.target?.event?.CONTENT_RENDERING_REDIRECT||"at-content-rendering-redirect"},{eventReference:document,eventType:window.adobe?.target?.event?.CONTENT_RENDERING_START||"at-content-rendering-start"},{eventReference:document,eventType:window.adobe?.target?.event?.CONTENT_RENDERING_SUCCEEDED||"at-content-rendering-succeeded"},{eventReference:document,eventType:window.adobe?.target?.event?.LIBRARY_LOADED||"at-library-loaded"},{eventReference:document,eventType:window.adobe?.target?.event?.REQUEST_FAILED||"at-request-failed"},{eventReference:document,eventType:window.adobe?.target?.event?.REQUEST_START||"at-request-start"},{eventReference:document,eventType:window.adobe?.target?.event?.REQUEST_SUCCEEDED||"at-request-succeeded"}].forEach((e=>{e.eventReference.addEventListener(e.eventType,(t=>{window.phoenix.bus.publish("ADOBE_TARGET","EVENT",{payload:{eventType:e.eventType,eventReference:e.eventReference,event:t}})}))}));const f={appName:"phoenix-platform",className:"script-injectables"};let l;const d=Number(window.phoenix.configs.scriptInjectionTimes),h=[{eventReference:document,eventType:"click"},{eventReference:document,eventType:"touchstart"},{eventReference:document,eventType:"keydown"},{eventReference:document,eventType:"scroll"},{eventReference:window,eventType:"load"},{eventReference:window,eventType:"DOMContentLoaded"}];function p(e){if(e.injected)return;e.injected=!0;const t=document.createElement("script");e.scriptId&&(t.id=e.scriptId),"url"===e.scriptSource?function(e,t){let n,r;t.src=e.scriptUrl,n=()=>{t.removeEventListener("load",n),t.removeEventListener("error",r),window.requestAnimationFrame((()=>{v(e.id,window.phoenix.scriptInjections)}))},r=()=>{t.removeEventListener("load",n),t.removeEventListener("error",r)},t.addEventListener("load",n),t.addEventListener("error",r)}(e,t):"manual"===e.scriptSource&&(t.innerText=e.scriptCode);try{document.body.appendChild(t)}catch(t){window.phoenix.log.warning(`Injectable failed to load: ${e.scriptName}`,f,{exception:t,inject:e})}"manual"===e.scriptSource&&window.requestAnimationFrame((()=>{v(e.id,window.phoenix.scriptInjections)}))}function v(e,t){const n=(navigator.userAgent||"").toLowerCase().includes("applicationversioncode"),r=window.phoenix?.checkFeatureFlag("delayScriptInjections");t.filter((e=>!e.injected)).forEach((t=>{if(t.dependency===e){if(n&&!t.enabledMobileApp)return void window.phoenix.log.warning(`Skipping script injection for mobile native app: ${t.scriptName}`,f,t);t.naughtyList&&r?(l=setTimeout(p,d,t),document.addEventListener("at-request-failed",(()=>{w(t,l)})),document.addEventListener("at-content-rendering-succeeded",(()=>{w(t,l)})),document.addEventListener("at-content-rendering-failed",(()=>{w(t,l)})),document.addEventListener("at-content-rendering-no-offers",(()=>{w(t,l)}))):p(t)}}))}function b(e=(()=>!0)){h.filter(e).forEach((e=>{e.eventListener&&e.eventReference.removeEventListener(e.eventType,e.eventListener)}))}function w(e,t){clearTimeout(t),p(e)}function g(e){"DOMContentLoaded"===e.type?(b((e=>"DOMContentLoaded"===e.eventType)),m=window.phoenix.scriptInjections.filter((e=>e.runOnDomContentLoaded)),window.requestAnimationFrame((()=>{v("",m)}))):(b(),y=window.phoenix.scriptInjections.filter((e=>!e.runOnDomContentLoaded)),window.requestAnimationFrame((()=>{v("",y)})))}let m,y;h.forEach((e=>{e.eventListener=g,e.eventReference.addEventListener(e.eventType,e.eventListener,{once:!0})})),window._taq=window._taq||[],(new class{domainConfigs={};startApp(){const e=window.phoenix.configs?.apiDomainsConfigs??{};for(const t in e)this.domainConfigs[t]={...e[t],apiPath:new RegExp(e[t].apiPath,"i")};window.fetchIntercept.register({request:this.requestInterceptor.bind(this)})}requestInterceptor(e,t){return e instanceof Request?[this.applyUrlDomain(e.url),new Request(e,t)]:[this.applyUrlDomain(e),t]}applyUrlDomain(e){if(/^https?:\/\//i.test(e))return e;let t=0,n="";for(const r in this.domainConfigs){const o=this.domainConfigs[r].apiPath.exec(e);o&&o.length>0&&o[0].length>t&&(t=o[0].length,n=this.domainConfigs[r].targetDomain)}return n.length>0?new URL(e,n).toString():e}}).startApp()}()}();